<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>用户注册</title>
		<style>
		</style>
	</head>
	<body>
		<h2>用户注册</h2>
		<table border="0" cellspacing="" cellpadding="">
			<form id="registrationForm" onsubmit="return validateForm()">
				<tr>
					<td>
						<label for="email">用户名：</label>
					</td>
					<td>
						<input type="text" id="name" name="email" required><br>
					</td>
				</tr>
				<tr>
					<td>
						<label for="email">密码：</label>
					</td>
					<td>
						<input type="password" id="pass" name="email" required><br>
					</td>
				</tr>
				<tr>
					<td>
						<label for="email">邮箱：</label>
					</td>
					<td>
						<input type="email" id="email" name="email" required><br>
					</td>
				</tr>
				<tr>
					<td>
						<label for="phone">手机号码：</label>
					</td>
					<td>
						<input type="tel" id="phone" name="phone" required><br></td>
				</tr>
				<tr>
					<td>
						<label for="birthday">生日：</label>
					</td>
					<td>
						<input type="text" id="birthday" name="birthday" required><br>
					</td>
				</tr>
				<tr>
					<td><button type="submit">注册</button></td>
				</tr>
			</form>
		</table>
		<script>
			var emailRe = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

			var phoneRe = /^\d{11}$/;

			var birthdayRe = /^\d{4}-\d{2}-\d{2}$/;

			function validateForm() {
				var email = document.getElementById("email").value;
				var phone = document.getElementById("phone").value;
				var birthday = document.getElementById("birthday").value;

				if (!emailRe.test(email)) {
					alert("邮箱格式不正确");
					return false;
				}

				if (!phoneRe.test(phone)) {
					alert("手机号格式不正确");
					return false;
				}

				if (!birthdayRe.test(birthday)) {
					alert("生日格式不正确");
					return false;
				}

				if (birthdayRe.test(birthday) && phoneRe.test(phone) && emailRe.test(email)) {
					alert("完成注册")
				}
				return true;
			}
		</script>
	</body>
</html>
